Skip to content

Improve error message for manual orchestrator and entity function invocation#3302

Draft
Copilot wants to merge 2 commits intodevfrom
copilot/improve-error-message-orchestrator
Draft

Improve error message for manual orchestrator and entity function invocation#3302
Copilot wants to merge 2 commits intodevfrom
copilot/improve-error-message-orchestrator

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

Summary

What changed?

  • Updated OrchestrationTriggerAttributeBindingProvider.BindAsync to throw InvalidOperationException with a clear message explaining orchestrator functions don't support direct invocation
  • Applied same fix to EntityTriggerAttributeBindingProvider.BindAsync for consistency

Why is this change needed?

When users attempt to manually trigger an orchestrator function from the Azure Portal, they get a cryptic error:

System.ArgumentException: Cannot convert to DurableOrchestrationContext.

Now they get:

System.InvalidOperationException: Durable orchestrator functions do not support direct invocation. 
To start an orchestration, use an HTTP trigger function or the DurableClient binding to call 'StartNewAsync'.

Issues / work items


Project checklist

  • Documentation changes are not required
  • Release notes are not required for the next release
  • Backport is not required
  • All required tests have been added/updated (unit tests, E2E tests)
  • No extra work is required to be leveraged by OutOfProc SDKs
  • No change to the version of the WebJobs.Extensions.DurableTask package
  • No EventIds were added to EventSource logs
  • This change should be added to the v2.x branch
  • Breaking change?

AI-assisted code disclosure (required)

Was an AI tool used? (select one)

  • No
  • Yes, AI helped write parts of this PR (e.g., GitHub Copilot)
  • Yes, an AI agent generated most of this PR

If AI was used:

  • Tool(s): GitHub Copilot
  • AI-assisted areas/files: OrchestrationTriggerAttributeBindingProvider.cs, EntityTriggerAttributeBindingProvider.cs
  • What you changed after AI output: N/A

AI verification (required if AI was used):

  • I understand the code and can explain it
  • I verified referenced APIs/types exist and are correct
  • I reviewed edge cases/failure paths (timeouts, retries, cancellation, exceptions)
  • I reviewed concurrency/async behavior
  • I checked for unintended breaking or behavior changes

Testing

Automated tests

  • Result: Build passed; no behavioral change requiring new tests (error message text only)

Manual validation (only if runtime/behavior changed)

  • N/A - Error message text change only

Notes for reviewers

  • Minimal change: swapped ArgumentExceptionInvalidOperationException and improved message text in both orchestrator and entity trigger bindings

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • azfunc.pkgs.visualstudio.com
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.23.8/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp /opt/hostedtoolcache/CodeQL/2.23.8/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Need a friendlier error message when attempting to invoke an orchestrator function from the portal</issue_title>
<issue_description>Related to #10 and https://stackoverflow.com/questions/45063647/durable-functions-infinite-execution-with-state-doesnt-work?rq=1

Here is the error message if you try to manually trigger an orchestrator function:

Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: SayHello ---> System.InvalidOperationException : Exception binding parameter 'context' ---> System.ArgumentException : Cannot convert  to DurableOrchestrationContext.
   at Microsoft.Azure.WebJobs.Extensions.DurableTask.ObjectValueProvider..ctor(Object value,Type valueType)
   at Microsoft.Azure.WebJobs.Extensions.DurableTask.OrchestrationTriggerAttributeBindingProvider.OrchestrationTriggerBinding.BindAsync(Object value,ValueBindingContext context)
   at async Microsoft.Azure.WebJobs.Host.Triggers.TriggeredFunctionBinding`1.BindCoreAsync[TTriggerValue](ValueBindingContext context,Object value,IDictionary`2 parameters)

Ideally we can detect this and throw a more meaningful exception - e.g. "Durable orchestrator functions do not support manual invocation." and maybe offer a suggested workaround.</issue_description>

<agent_instructions>check if this issue still exists, if so fix it</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…ocation

Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve error message for orchestrator function invocation Improve error message for manual orchestrator and entity function invocation Jan 5, 2026
Copilot AI requested a review from YunchuWang January 5, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants